#pragma once

#include "mod.h"

namespace sfc::cmp {

enum Ordering {
  Equal = 0,
  Less = -1,
  Greater = 1,
};

struct Eq {
  [[sfc_inline]] static auto operator()(const auto& a, const auto& b) -> bool {
    return a == b;
  }
};

struct Ne {
  [[sfc_inline]] static auto operator()(const auto& a, const auto& b) -> bool {
    return a != b;
  }
};

struct Lt {
  [[sfc_inline]] static auto operator()(const auto& a, const auto& b) -> bool {
    return a < b;
  }
};

struct Gt {
  [[sfc_inline]] static auto operator()(const auto& a, const auto& b) -> bool {
    return a > b;
  }
};

[[sfc_inline]] constexpr auto min(const auto& a, const auto& b) -> auto {
  return a < b ? a : b;
}

[[sfc_inline]] constexpr auto max(const auto& a, const auto& b) -> auto {
  return a < b ? b : a;
}

}  // namespace sfc::cmp
